<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/common/include.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主页 | 短信平台</title>
<jsp:include page="/WEB-INF/jsp/common/commonlist.jsp"></jsp:include>
</head>
<body onload="bodyLoad()">
<div id="body-wrapper">
  <!-- Wrapper for the radial gradient background -->
  <div id="sidebar">
    <div id="sidebar-wrapper">
      <!-- Sidebar with logo and menu -->
      <h1 id="sidebar-title"><a href="#">短信平台</a></h1> 
      <!-- Logo (221px wide) -->

      <!-- Sidebar Profile links -->
     	 <!--  页面左上角的部分 -->
     <%@include file="/WEB-INF/jsp/common/leftTop.jsp" %>
     <!-- 页面左侧菜单部分 -->
     <%@include file="/WEB-INF/jsp/common/menu.jsp" %>
    </div>
  </div>
  <!-- End #sidebar -->
  <div id="main-content">
    <!-- Main Content Section with everything -->
    <noscript>
    <!-- Show a notification if the user has disabled javascript -->
    <div class="notification error png_bg">
      <div> Javascript is disabled or is not supported by your browser. Please <a href="http://browsehappy.com/" title="Upgrade to a better browser">upgrade</a> your browser or <a href="http://www.google.com/support/bin/answer.py?answer=23852" title="Enable Javascript in your browser">enable</a> Javascript to navigate the interface properly.
        Download From <a href="http://www.exet.tk">exet.tk</a></div>
    </div>
    </noscript>
   <%@ include file="/WEB-INF/jsp/common/top.jsp" %>
    <!-- End .shortcut-buttons-set -->
    <div class="clear"></div>
    <!-- End .clear -->
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>发送短信</h3>
        <ul class="content-box-tabs">
        </ul>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
          <form action="importData.do" method="post" enctype="multipart/form-data" id="phoneNumberForm">
            <fieldset>
            <p>
              <label style="display: inline; margin-right:230px;">号码编辑</label>
              <label style="display: inline; margin-right:140px;">移动</label><label style="display: inline; margin-right:140px;">联通</label>
              <label style="display: inline; margin-right:60px;">电信</label><br/>
              	说明：请导入txt类型文件,号码以逗号分隔<br/>
              <textarea class="text-input textarea" id="phoneContent" name="phoneContent" cols="30" rows="15" style="width: 20% !important;margin-right: 60px;">${content}${phoneContent}</textarea>
              <textarea class="text-input textarea" id="yd_text" name="yd_text" cols="30" rows="15" style="width: 15% !important;">${map.yd}</textarea>
              <textarea class="text-input textarea" id="liantong_text" name="liantong_text" cols="30" rows="15" style="width: 15% !important;">${map.liantong}</textarea>
              <textarea class="text-input textarea" id="dx_text" name="dx_text" cols="30" rows="15" style="width: 15% !important;">${map.dx}</textarea><br/>
              <input type="file" name="importData" style="margin-right: 200px;" id="importData"/> 
              <input style="margin-left: 40px; margin-right: 15px;" class="button" type="button" value="去重" onclick="delSameNumber()" id="delSame" name="delSame" />
              <input class="button" type="button" value="分析" id="analyse" name="analyse" onclick="analyseNumber()"/><br/>
              <input class="button" type="submit" value="导入" style="margin-right:200px;"/>
            </p>
            <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
            <p><label style="display: inline;">可发短信数</label>(${messageCount}条)</p>
            <p>
              <label>发送方式</label>
              <input type="radio" name="radio1" checked="checked" onclick="groupSend()"/>
              号码列表发送<br />
              <input type="radio" name="radio1" id="groupRadio" onclick="groupSend()"/>
              号码群组发送 </p>
            <p style="display: none;" id="groupSend">
              <label>群组选择</label>
              <select name="group" id="group" onchange="importPhones();">
              	<option value="0">=请选择=</option>
	            <c:forEach items="${listGroup}" var="listGroup">
	              <option value="${listGroup.groupId}">${listGroup.groupName}</option>
	            </c:forEach>
              </select>
            </p>
            <!-- <p>
            	<label style="display: inline; ">定时短信</label>
            	<input type="checkbox" id="checkTimeJob" onclick="showTimeJob()" name="checkTimeJob"/>
            	<span style="display: none;" id="timeJob">
            		<input type="text" name="day" id="day"/>日
            		<select name="hour" id="hour" >  
            			<option value="00">00</option>
            			<option value="01">01</option>
            			<option value="02">02</option>
            			<option value="03">03</option>
            			<option value="04">04</option>
            			<option value="05">05</option>
            			<option value="06">06</option>
            			<option value="07">07</option>
            			<option value="08">08</option>
            			<option value="09">09</option>
            			<option value="10">10</option>
            			<option value="11">11</option>
            			<option value="12">12</option>
            			<option value="13">13</option>
            			<option value="14">14</option>
            			<option value="15">15</option>
            			<option value="16">16</option>
            			<option value="17">17</option>
            			<option value="18">18</option>
            			<option value="19">19</option>
            			<option value="20">20</option>
            			<option value="21">21</option>
            			<option value="22">22</option>
            			<option value="23">23</option></select>时</span>
            </p> -->
            <p style="display: none;"><label style="display: inline;">选择通道：</label>
            	<select name="channel" id="channel" >
            		<c:forEach items="${list}" var="channel"> 
            			<option value="${channel.tdId}">${channel.tdmc}</option>
            		</c:forEach></select></p>
            <p>
              <label>发送内容</label>
              <textarea class="text-input textarea" id="sendInfoText" name="sendInfo" cols="60" rows="15" style="width: 72% !important;"></textarea>
            </p>
            <p>
              <input class="button" type="button" value="发送" onclick="sendMessageInfo()"/>
            </p>
            </fieldset>
            <div class="clear" style="display: none;"><textarea id="t_phoneContent" name="t_phoneContent">${t_phoneContent}</textarea></div>
            <!-- End .clear -->
          </form>
        </div>
        <!-- End #tab2 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    <!-- End .content-box -->
    <div class="clear"></div>
    <%@ include file="/WEB-INF/jsp/common/copyright.jsp" %>
  </div>
  <!-- End #main-content -->
</div>
</body>
<script type="text/javascript">
	//日期插件
	$(document).ready(function() {
		$("#day").datepicker();
	}); 
	function logout(){
		return confirm('确定退出当前系统吗？');
	}
	function showTimeJob(){
		var radio = document.getElementById("checkTimeJob");
		if(radio.checked){
			document.getElementById("timeJob").style.display="block";
		}else{
			document.getElementById("timeJob").style.display="none";
		}
	}
	function groupSend(){
		var radio = document.getElementById("groupRadio");
		if(radio.checked){
			document.getElementById("groupSend").style.display="block";
		}else{
			document.getElementById("groupSend").style.display="none";
		}
	}
	function delSameNumber(){
		var form = document.getElementById("phoneNumberForm");
		form.action = "delSameNumber.do";
		form.submit();
	}
	function analyseNumber(){
		var form = document.getElementById("phoneNumberForm");
		form.action = "analyseNumber.do";
		form.submit();
	}
	function bodyLoad(){
		activeMenuItem("messageManageItem","sendMessage");
	}
	function importPhones(){
		$.ajax({
			   type: "POST",
			   url: "${ctx}/importPhones.do",
			   data: "group="+$('#group').val(),
			   error : function() {
				   alert("发送数据错误！");
				},
				success : function(msg) {
					document.getElementById("phoneContent").innerHTML=msg.substring(1, msg.lastIndexOf('"'));
				}
			});
	}
	function sendMessageInfo(){
		$.ajax({
		   type: "POST",
		   url: "${ctx}/sendMessageInfo.do",
		   data: "channel="+$('#channel').val()+"&t_phoneContent="+$('#t_phoneContent').val()+"&sendInfo="+$('#sendInfoText').val(),
		   error : function() {
			   alert("发送数据错误！");
			},
			success : function(msg) {
/* 				if(msg=='vaild'){
			 		var form = document.getElementById("phoneNumberForm");
			 		form.action = "sendMessageInfo.do";
			 		form.submit(); 
				} */
				alert(msg);
// 				showTsxx(data,function(){
// 					$("#searchform").submit();
// 				});
			}
		});
	}
</script>
</html>